package com.boot.security.server.utils.mffl;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 返回的实体
 *
 * @author Node
 * @time 2017-10-25
 */
@ApiModel(value = "返回说明")
public class ReturnBean<T> {
    @ApiModelProperty(value = "状态码200为正常 其它为失败")
    private String errCode;// 状态码200为正常 其它为失败
    @ApiModelProperty(value = "错误信息")
    private String message;// 错误信息 如果成功了则为空 失败了要描述
    @ApiModelProperty(value = "版本号")
    private String version;// 版本号
    @ApiModelProperty(value = "数据内容")
    private T datas;// 储存数据


    //自定义
    public void setReturnBean(String errCode) {
        switch (errCode) {
            case "101":
                this.setMessage("验证码过期");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "200":
                this.setMessage("请求已成功");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "102":
                this.setMessage("手机号不正确");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "103":
                this.setMessage("验证码不正确");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "104":
                this.setMessage("该服务没有类型");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "105":
                this.setMessage("操作失败请稍后再试");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "106":
                this.setMessage("当前操作目标不存在");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "107":
                this.setMessage("当前操作对象无需重复操作");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "108":
                this.setMessage("问题已有最佳答案，无法修改");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "109":
                this.setMessage("参数为空");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "110":
                this.setMessage("该类型不存在");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "111":
                this.setMessage("图片已存在，不允许重复上传");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "112":
                this.setMessage("该律师还未定义此项收费标准");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "113":
                this.setMessage("订单已支付无需重复支付");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "114":
                this.setMessage("该订单已申请退款");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "115":
                this.setMessage("平台没有此项服务");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "116":
                this.setMessage("律师不存在");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "117":
                this.setMessage("律师已发货，不可以撤销");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "118":
                this.setMessage("当前为待支付状态，不可执行此操作");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "120":
                this.setMessage("用户未填写完整收件信息，不允许执行此操作");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "121":
                this.setMessage("用户未设置手机号");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "122":
                this.setMessage("当前用户为律师身份，不允许发起合同服务");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "123":
                this.setMessage("支付异常");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "124":
                this.setMessage("当前手机号已注册为用户");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "125":
                this.setMessage("当前手机号已注册为律师");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "126":
                this.setMessage("订单已支付，无需重复支付");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "127":
                this.setMessage("订单已退款，无需重复操作");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "128":
                this.setMessage("订单已申请退款，等待工作人员核实");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "129":
                this.setMessage("订单还未支付，无需操作");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "130":
                this.setMessage("该微信号没有绑定手机号，请绑定手机号");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "131":
                this.setMessage("该手机号已经被绑定，请更换手机号");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "132":
                this.setMessage("微信授权不正确或者已过期");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "133":
                this.setMessage("当前没有可设置的收费项");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "134":
                this.setMessage("您未设置银行卡信息");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "135":
                this.setMessage(" 图片过大无法上传，请换一张");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "136":
                this.setMessage(" 文件类型不可上传");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "137":
                this.setMessage("当前律师未通过认证");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "138":
                this.setMessage("当前用户不是律师，无法操作");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "139":
                this.setMessage("订单不存在，或订单状态不正确");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "140":
                this.setMessage("退款失败");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "141":
                this.setMessage("订单状态正常，无需修改");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "142":
                this.setMessage("商户订单号已下过单，重新生成订单号");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "143":
                this.setMessage("上传文件不符合要求");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
            case "144":
                this.setMessage("手机号已被其他用户绑定，请更换手机号！");
                this.setErrCode(errCode);
                this.setVersion("1.0");
                break;
        }
    }


    public ReturnBean() {
        this.version = "1.0";
        this.errCode = "200";
        this.message = "成功";
    }

    public ReturnBean(String stateCode, String errMsg) {
        super();
        this.version = "1.0";
        this.errCode = stateCode;
        this.message = errMsg;
    }

    public ReturnBean(String stateCode, T datas, String errMsg) {
        super();
        this.errCode = stateCode;
        this.datas = datas;
        this.message = errMsg;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String code) {
        this.errCode = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public T getDatas() {
        return datas;
    }

    public void setDatas(T datas) {
        this.datas = datas;
    }

  /* public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }
*/
}